#include "bubble_sort.h"
#include "common/common.h"
#include "common/array.h"

void bubble_sort(array_t *array) {
  int i, j;
  int size = array->size;
  int *p = array->data;

  for (i = 0; i < size; ++i) {
    for (j = size - 1; j > i; --j) {
      if (p[j] < p[j - 1]) {
        exchange(&p[j], &p[j - 1]);
      }
    }
  }
}

